<!--[if lte IE 9]>
<div class="alert alert-warning">
    您的浏览器版本过低, 部分功能将无法使用。<br>
    我们建议您使用最新版本的Chrome浏览器。
</div>
<![endif]-->
<table id="status" class="table table-bordered table-striped">
    <thead>
        <tr>
            <th width="25%">Property</th>
            <th >Value</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Sys Platform</td>
            <td id="sys-platform"></td>
        </tr>
        <tr>
            <td>OS System</td>
            <td id="os-system"></td>
        </tr>
        <tr>
            <td>OS version</td>
            <td id="os-version"></td>
        </tr>
        <tr>
            <td>OS release</td>
            <td id="os-release"></td>
        </tr>
        <tr>
            <td>OS detail</td>
            <td id="os-detail"></td>
        </tr>
        <tr>
            <td>language</td>
            <td id="language"></td>
        </tr>
        <tr>
            <td>architecture</td>
            <td id="architecture"></td>
        </tr>
        <tr>
            <td>Browser</td>
            <td id="browser"></td>
        </tr>
        <tr>
            <td>XX-Net Version</td>
            <td id="xxnet-version"></td>
        </tr>
        <tr>
            <td>Launcher Version</td>
            <td id="launcher-version"></td>
        </tr>
        <tr>
            <td>GoAgent Version</td>
            <td id="goagent-version"></td>
        </tr>
        <tr>
            <td>Python Version</td>
            <td id="python-version"></td>
        </tr>
        <tr>
            <td>Proxy Listen</td>
            <td id="proxy-listen"></td>
        </tr>
        <tr hidden="true">
            <td>Set appids</td>
            <td id="gae-appid"></td>
        </tr>
        <tr>
            <td>working appids</td>
            <td id="working-appid"></td>
        </tr>
        <tr>
            <td>Out of Quota appids</td>
            <td id="out-of-quota-appids"></td>
        </tr>
        <tr>
            <td>Not Exist appids</td>
            <td id="not-exist-appids"></td>
        </tr>
        <tr>
            <td>PAC URL</td>
            <td id="pac-url"></td>
        </tr>
        <tr>
            <td>Google IP</td>
            <td id="gws-ip-num"></td>
        </tr>
        <tr>
            <td>connected link(<a href="https://github.com/XX-net/XX-Net/wiki/GoAgent-Connection-status" target="_blank">帮助</a>)</td>
            <td id="connected-link"></td>
        </tr>
        <tr>
            <td>ip-connect-interval</td>
            <td id="ip-connect-interval"></td>
        </tr>
        <tr>
            <td>scan ip thread num</td>
            <td id="scan-ip-thread-num"></td>
        </tr>
        <tr>
            <td>block stat(<a href="https://github.com/XX-net/XX-Net/wiki/GoAgent-Blocked" target="_blank">帮助</a>)</td>
            <td id="block-stat"></td>
        </tr>
    </tbody>
</table>
<div id="tip">
    <p>
        <a href="https://github.com/XX-net/XX-Net/issues">报告问题</a>, 请附上<a href="http://127.0.0.1:8085/?module=goagent&menu=status" target="-blank">状态页</a>信息和<a href="http://127.0.0.1:8085/?module=goagent&menu=logging" target="-blank">日志页</a>内容, 方便分析问题。<br><br>
    </p>
</div>

<!-- JavaScript -->
<script type="text/javascript">
    title('GoAgent状态信息');
</script>
<script type="text/javascript">
    $(function() {
        var timer = $.timer(function() {
            getStatus();
        });

        timer.set({
            time: 1000,
            autostart: true
        });
    });
</script>
<script type="text/javascript">
    $(function() {
        getStatus();
    });
</script>
<script type="text/javascript">
    function getStatus() {
        $.ajax({
            type: 'GET',
            url: 'http://127.0.0.1:8084/status',
            dataType: 'JSON',
            success: function(result) {
                $('#sys-platform').html(result['sys_platform']);
                $('#os-system').html(result['os_system']);
                $('#os-version').html(result['os_version']);
                $('#os-release').html(result['os_release']);
                $('#os-detail').html(result['os_detail']);
                $('#language').html(result['language']);
                $('#architecture').html(result['architecture']);
                $('#browser').html(result['browser']);
                $('#xxnet-version').html(result['xxnet_version']);
                $('#launcher-version').html(result['launcher_version']);
                $('#goagent-version').html(result['goagent_version']);
                $('#python-version').html(result['python_version']);
                $('#proxy-listen').html(result['proxy_listen']);
                $('#pac-url').html(result['pac_url']);
                $("#gws-ip-num").html(result['gws_ip_num']);
                $("#connected-link").html(result['connected_link']);
                $('#gae-appid').html(result['gae_appid']);
                $('#working-appid').html(result['working_appid']);
                $('#out-of-quota-appids').html(result['out_of_quota_appids']);
                $('#not-exist-appids').html(result['not_exist_appids']);
                $('#ip-connect-interval').html(result['ip_connect_interval']);
                $('#scan-ip-thread-num').html(result['scan_ip_thread_num']);
                $('#block-stat').html(result['block_stat']);

                if ( !tipHasClose() ) {
                    tipClose();
                }
            },
            error: function(result) {
                var formValue = $('#sys-platform').html();

                if ( tipHasClose() ) {
                    $('html, body').animate({
                        scrollTop: 0
                    }, 'slow');
                }

                if ( formValue == '' ) {
                    tip('状态页显示空白, 很可能GoAgent启动失败, 请按<a href="https://github.com/XX-net/XX-Net/wiki/How-to-get-start-error-log" target="_blank">指引</a>查找问题原因.<br>', 'warning', false);
                } else {
                    tip('GoAgent进程无响应, 可能已退出.', 'warning', false);
                }
            }
        });
    }
</script>
